fix apps menu not closing when the window is hidden, and make group folders menu work again
this change resolves this ReferenceError when the window is being closed:
```
2025-01-08 10:56:40:389 [ warning default qrc:/qml/src/gui/tray/MainWindow.qml:100 ]: qrc:/qml/src/gui/tray/MainWindow.qml:100: ReferenceError: appsMenu is not defined
```
I also noticed that the "Open local or group folders" dropdown menu
wouldn't show up due to this error:
```
2025-01-08 10:56:23:327 [ warning default qrc:/qml/src/gui/tray/TrayFoldersMenuButton.qml:33 ]: qrc:/qml/src/gui/tray/TrayFoldersMenuButton.qml:33: Error: Cannot call method QQuickPopup::open on QQuickLoader_QML_48(0x5569fb4648d0)
```
--> wrapped the calls to the open/close methods in a closure
Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>